#include<bits/stdc++.h>
using namespace std;
FILE*freopen(const char*duel.in,const char*r,FILE*stdin);
FILE*freopen(const char*duel.out,const char*w,FILE*stdout);
int main()
{
   int nout=0,n,m=0,z=0,a[n+1]={},am=0,an=0;
   cin>>n;cout<<endl;
   while(z<n)
   {
       cin>>a[z];
       ++z;
   }
       if(n%2!=0)
       {
           for(int x=0;x<=2*n;++x)
           {
               for(int b=1;b<=n;b++)
               {
                   am=a[b-1];an=a[b];
                   if(a[b-1]<=a[b])
                   {
                       a[b-1]=an;a[b]=am;
                   }
               }
           }
       }
       if(n%2==0)
       {
           for(int x=0;x<=n*9/2-8;++x)
           {
               for(int b=1;b<=n;b++)
               {
                  am=a[b-1];an=a[b];
                   if(a[b-1]<=a[b])
                   {
                       a[b-1]=an;a[b]=am;
                   }
               }
           }
       }
   for(int i=0;i<=n;i++)
   {
       if(a[i]>a[i+1])nout+=1;
   }
   cout<<(n-nout)<<endl;
    return 0;
}
